package com.gxa.admin.controller;

import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.R;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.pojo.Dept;
import com.gxa.modules.service.DeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: microloans_system
 * @description: 部门
 * @author: LC
 * @create: 2022-01-04 09:16
 */

@Api(value = "部门管理接口",tags = "（李晨）部门管理接口")
@RestController
@RequestMapping("/dept")
public class DepartmentController {

    @Autowired(required = false)
    DeptService deptService;


    @ApiOperation(value = "获取部门（分页）", notes = "获取部门（分页）", response = R.class)
    @PostMapping("/getDeptPage")
    public ResultVo getDeptPage(@RequestBody PageRecv pageRecv){
        ResultVo r=deptService.getDeptPage(pageRecv);
        return r;
    }

    @ApiOperation(value = "添加部门", notes = "添加部门", response = R.class)
    @PostMapping("/addDept")
    public ResultVo addDept(@RequestBody Dept dept){
        ResultVo r=deptService.addDept(dept);
        return r;
    }

    @ApiOperation(value = "修改部门", notes = "修改部门", response = R.class)
    @PostMapping("/modifyDept")
    public ResultVo modifyDept(@RequestBody Dept dept){
        ResultVo r=deptService.modifyDept(dept);
        return r;
    }

    @ApiOperation(value = "删除部门", notes = "删除部门", response = R.class)
    @PostMapping("/delDept")
    public ResultVo delDept(@RequestBody Dept dept){
        ResultVo r=deptService.delDept(dept);
        return r;
    }

    @ApiOperation(value = "获取成员数", notes = "获取成员数", response = R.class)
    @PostMapping("/getMemberCount")
    public ResultVo getMemberCount(@RequestBody Dept dept){
        ResultVo r=deptService.getMemberCount(dept);
        return r;
    }




}